package com.qianbei.user.privacy;

import android.os.Bundle;
import android.text.Html;
import android.widget.TextView;

import com.android.volley.Request.Method;
import com.qianbei.R;
import com.qianbei.common.base.BaseActivity;
import com.qianbei.common.net.control.ServerResult;

import java.net.URLEncoder;

public class PrivacyActivity extends BaseActivity{
	
	public TextView webView;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		webView =new TextView(this);
		
		setContentView(R.layout.privacy_activity);
		webView =(TextView) findViewById(R.id.text_all);
		comment_types("");
		setTitle("隐私声明");
	}
	
	public void loadNativyData(String data) {
//		webView.loadData(fmtString(data), "text/html", "utf-8");
		
		 CharSequence charSequence=Html.fromHtml(data);  
		 webView.setText(charSequence);  
	        //该语句在设置后必加，不然没有任何效果  
//		 webView.setMovementMethod(LinkMovementMethod.getInstance());
	}

	private String fmtString(String str) {
		String notice = "";
		try {
			notice = URLEncoder.encode(str, "utf-8");
		} catch (Exception ex) {
		}
		return notice;
	}
	
	/**
	 *隐私声明接口
	 * 
	 * @param tag
	 */
	public void comment_types(String tag) {
		initAlertServer(Method.GET, PRIVATYURL + "?" + "tag=" + tag
				+ "&");
	}
	@Override
	public void serverFinish(ServerResult sr) {
		if(sr.isContinue){
			
			
				loadNativyData(sr.bodyData.optString("statement"));
		}
		
	}

}
